﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using System;

#endregion


namespace ScrumTable.DL.Data.Generic.Cache
{
    /// <summary>
    /// This class represents the base interface for all tfs elements.
    /// </summary>
    public interface ICacheTrackedElement : ICloneable
    {
        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------

        /// <summary>
        /// Gets the name of the underlying iteration.
        /// </summary>
        string Name { get; set; }

        /// <summary>
        /// Returns true if the current element has changes. This property
        /// is independent from the elements children.
        /// </summary>
        bool CurrentIsDirty { get; }

        /// <summary>
        /// Gets true if this element must be send back to the server. This
        /// property returns true if the current element or a child is dirty.
        /// </summary>
        bool IsDirty { get; }

        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

        /// <summary>
        /// Removes the dirty flag. This should be done after a clone has
        /// been created of the current element so the changes should be
        /// commited to the server.
        /// </summary>
        void RemoveDirtyFlag();

        /// <summary>
        /// Merges the values of the given object into the current cache
        /// element. The cache element must be of the same type as the
        /// current instance is.
        /// </summary>
        /// <param name="toMerge">Specifies the object to import.</param>
        /// <param name="saveProgressFeedback">Specifies the save feedback from the underlying system.</param>
        void MergeChanges(ICacheTrackedElement toMerge, ICacheSaveProgressFeedback saveProgressFeedback);

        #endregion

        #region Events

        //--------------------------------------------------------------------
        // Events
        //--------------------------------------------------------------------

        #endregion
    }
}